package com.taobao.top.api;

import java.util.TreeMap;

import com.taobao.top.api.exception.ApiException;
import com.taobao.top.beans.AppConstants;
import com.taobao.top.utils.APIUtil;

/**
 * 商品API
 * <p>
 * 提供了商品以及商品相关的sku，邮费增加，修改功能
 * 
 * @see http://open.taobao.com/doc/api_cat_detail.htm?cat_id=4&category_id=102
 * @author
 * 
 */
public class Shangpin_API
{
	/**
	 * 查询用户设置的售后服务模板，仅返回标题和id
	 * 
	 * @param format
	 * @return
	 * @throws ApiException
	 */
	public String getAftersale(String format) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/******************************************* taobao.item.add is missing *******************************************/

	/**
	 * 删除单条商品
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，该参数必须
	 * @return
	 * @throws ApiException
	 */
	public String deleteItem(String format, String mNum_iid)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 获取单个商品的详细信息 卖家未登录时只能获得这个商品的公开数据，卖家登录后可以获取商品的所有数据
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID
	 * @param mFields
	 *            需要返回的商品对象字段
	 * @return 获取的商品 具体字段根据权限和设定的fields决定
	 * @throws ApiException
	 */
	public String getItem(String format, String mNum_iid, String mFields)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mFields", mFields);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 删除itemimg_id 所指定的商品图片 传入的num_iid所对应的商品必须属于当前会话的用户
	 * itemimg_id对应的图片需要属于num_iid对应的商品
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，必选
	 * @param mId
	 *            商品图片ID
	 * @return
	 * @throws ApiException
	 */
	public String deleteImg(String format, String mNum_iid, String mId)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mId", mId);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 添加一张商品图片到num_iid指定的商品中 传入的num_iid所对应的商品必须属于当前会话的用户 如果更新图片需要设置itemimg_id，
	 * </p>
	 * <p>
	 * 且该itemimg_id的图片记录需要属于传入的num_iid对应的商品。如果新增图片则不用设置 商品图片有数量和大小上的限制，
	 * </p>
	 * <p>
	 * 根据卖家享有的服务（如：卖家订购了多图服务等），商品图片数量限制不同。
	 * </p>
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，该参数必须
	 * @param id
	 *            商品图片id(如果是更新图片，则需要传该参数)
	 * @param position
	 *            图片序号
	 * @param image
	 *            商品图片内容类型:JPG,GIF;最大长度:500K 。支持的文件类型：gif,jpg,jpeg,png
	 *            支持的文件类型：gif,jpg,jpeg,png,bmp
	 * @param is_major
	 *            是否将该图片设为主图,可选值:true,false;默认值:false(非主图)
	 * @return
	 * @throws ApiException
	 */
	public String upoloadImg(String format, String mNum_iid, String id,
			String position, String image, String is_major) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("position", position);
		}
		if (image != null || !image.equals(""))
		{
			apiparamsMap.put("image", image);
		}
		if (is_major != null || !is_major.equals(""))
		{
			apiparamsMap.put("is_major", is_major);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 关联一张商品图片到num_iid指定的商品中 * 传入的num_iid所对应的商品必须属于当前会话的用户 *
	 * </p>
	 * <p>
	 * 商品图片关联在卖家身份和图片来源上的限制，卖家要是B卖家或订购了多图服务才能关联图片，
	 * </p>
	 * <p>
	 * 并且图片要来自于卖家自己的图片空间才行 * 商品图片数量有限制。不管是上传的图片还是关联的图片，他们的总数不能超过一定限额
	 * </p>
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，必选
	 * @param mPic_path
	 *            图片URL,图片空间图片的相对地址
	 * @param id
	 *            商品图片id(如果是更新图片，则需要传该参数)
	 * @param is_major
	 *            上传的图片是否关联为商品主图
	 * @param position
	 *            图片序号
	 * @return 商品图片信息
	 * @throws ApiException
	 */
	public String imgJoint(String format, String mNum_iid, String mPic_path,
			String id, String is_major, String position) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (is_major != null || !is_major.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mPic_path", mPic_path);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 关联一张商品属性图片到num_iid指定的商品中 * 传入的num_iid所对应的商品必须属于当前会话的用户 *
	 * <p>
	 * 图片的属性必须要是颜色的属性，这个在前台显示的时候需要和sku进行关联的 *
	 * <p>
	 * 商品图片关联在卖家身份和图片来源上的限制，卖家要是B卖家或订购了多图服务才能关联图片，
	 * <p>
	 * 并且图片要来自于卖家自己的图片空间才行 * 商品图片数量有限制。不管是上传的图片还是关联的图片，
	 * <p>
	 * 他们的总数不能超过一定限额，最多不能超过24张（每个颜色属性都有一张）
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，必选
	 * @param mPic_path
	 *            图片地址
	 * @param mProperties
	 *            属性列表。调用taobao.itemprops.get.v2获取类目属性，属性必须是颜色属性，再用taobao.
	 *            itempropvalues.get取得vid。格式:pid:vid。
	 * @param id
	 *            属性图片ID。如果是新增不需要填写
	 * @param position
	 *            图片序号
	 * @return 属性图片对象信息
	 * @throws ApiException
	 */

	public String propimgJoint(String format, String mNum_iid,
			String mPic_path, String mProperties, String id, String position)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("position", position);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mPic_path", mPic_path);
		apiparamsMap.put("mProperties", mProperties);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/******************************** taobao.item.price.update *************************************************************/

	/**
	 * 删除propimg_id 所指定的商品属性图片 传入的num_iid所对应的商品必须属于当前会话的用户
	 * propimg_id对应的属性图片需要属于num_iid对应的商品
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，必选
	 * @param mId
	 *            商品属性图片ID
	 * @return
	 * @throws ApiException
	 */
	public String deletePropimg(String format, String mNum_iid, String mId)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mId", mId);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 添加一张商品属性图片到num_iid指定的商品中 传入的num_iid所对应的商品必须属于当前会话的用户 图片的属性必须要是颜色的属性，
	 * <p>
	 * 这个在前台显示的时候需要和sku进行关联的 商品属性图片只有享有服务的卖家
	 * <p>
	 * （如：淘宝大卖家、订购了淘宝多图服务的卖家）才能上传 商品属性图片有数量和大小上的限制，最多不能超过24张（每个颜色属性都有一张
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，必选
	 * @param mProperties
	 *            属性列表。调用taobao.itemprops.get获取类目属性，属性必须是颜色属性，再用taobao.
	 *            itempropvalues.get取得vid。格式:pid:vid。
	 * @param id
	 *            属性图片ID。如果是新增不需要填写
	 * @param position
	 *            图片位置
	 * @param image
	 *            <p>
	 *            属性图片内容。类型:JPG,GIF;最大长度:500K;图片大小不超过:1M
	 *            <p>
	 *            支持的文件类型：gif,jpg,jpeg,png,bmp
	 * @return PropImg属性图片结构
	 * @throws ApiException
	 */
	public String upoloadPropimg(String format, String mNum_iid,
			String mProperties, String id, String position, String image)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("position", position);
		}
		if (image != null || !image.equals(""))
		{
			apiparamsMap.put("image", image);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mProperties", mProperties);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 提供按照全量或增量形式修改宝贝/SKU库存的功能
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mQuantity
	 * @param sku_id
	 * @param outer_id
	 * @param type
	 * @return
	 * @throws ApiException
	 */
	public String updateQuantity(String format, String mNum_iid,
			String mQuantity, String sku_id, String outer_id, String type)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mQuantity", mQuantity);
		if (sku_id != null || !sku_id.equals(""))
		{
			apiparamsMap.put("sku_id", sku_id);
		}
		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (type != null || !type.equals(""))
		{
			apiparamsMap.put("type", type);
		}

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 将当前用户指定商品设置为橱窗推荐状态 橱窗推荐需要用户有剩余橱窗位才可以顺利执行 这个Item所属卖家从传入的session中获取，
	 * <p>
	 * 需要session绑定 需要判断橱窗推荐是否已满，橱窗推荐已满停止调用橱窗推荐接口，
	 * <p>
	 * 2010年1月底开放查询剩余橱窗推荐数后可以按数量橱窗推荐商品
	 * 
	 * @param format
	 * @param mNum_iid
	 * @return
	 * @throws ApiException
	 */

	public String addRecommend(String format, String mNum_iid)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 取消当前用户指定商品的橱窗推荐状态 这个Item所属卖家从传入的session中获取，需要session绑定
	 * 
	 * @param format
	 * @param mNum_iid
	 *            商品数字ID，该参数必须
	 * @return
	 * @throws ApiException
	 */
	public String deleteRecommend(String format, String mNum_iid)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 新增一个sku到num_iid指定的商品中 传入的iid所对应的商品必须属于当前会话的用户
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mProperties
	 * @param mQuantity
	 * @param mPrice
	 * @param outer_id
	 * @param item_price
	 * @param lang
	 * @return
	 * @throws ApiException
	 */
	public String addSku(String format, String mNum_iid, String mProperties,
			String mQuantity, String mPrice, String outer_id,
			String item_price, String lang) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (item_price != null || !item_price.equals(""))
		{
			apiparamsMap.put("item_price", item_price);
		}
		if (lang != null || !lang.equals(""))
		{
			apiparamsMap.put("lang", lang);
		}
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mProperties", mProperties);
		apiparamsMap.put("mQuantity", mQuantity);
		apiparamsMap.put("mPrice", mPrice);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 删除一个sku的数据 需要删除的sku通过属性properties进行匹配查找
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mProperties
	 * @param mPrice
	 * @param item_price
	 * @param lang
	 * @return
	 * @throws ApiException
	 */
	public String deleteSku(String format, String mNum_iid, String mProperties,
			String mPrice, String item_price, String lang) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (item_price != null || !item_price.equals(""))
		{
			apiparamsMap.put("item_price", item_price);
		}
		if (lang != null || !lang.equals(""))
		{
			apiparamsMap.put("lang", lang);
		}
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mProperties", mProperties);
		apiparamsMap.put("mPrice", mPrice);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 获取sku_id所对应的sku数据 sku_id对应的sku要属于传入的nick对应的卖家
	 * 
	 * @param format
	 * @param mFields
	 * @param mSku_id
	 * @param num_iid
	 * @param nick
	 * @return
	 * @throws ApiException
	 */
	public String getSku(String format, String mFields, String mSku_id,
			String num_iid, String nick) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (num_iid != null || !num_iid.equals(""))
		{
			apiparamsMap.put("num_iid", num_iid);
		}
		if (nick != null || !nick.equals(""))
		{
			apiparamsMap.put("nick", nick);
		}
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mFields", mFields);
		apiparamsMap.put("mSku_id", mSku_id);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 查询当前登录用户的店铺的宝贝详情页的模板名称
	 * 
	 * @param format
	 * @return
	 * @throws ApiException
	 */
	public String getTemplates(String format) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 更新商品SKU的价格
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mProperties
	 * @param quantity
	 * @param price
	 * @param outer_id
	 * @param item_price
	 * @param lang
	 * @return
	 * @throws ApiException
	 */
	public String updatePriceSku(String format, String mNum_iid,
			String mProperties, String quantity, String price, String outer_id,
			String item_price, String lang) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (item_price != null || !item_price.equals(""))
		{
			apiparamsMap.put("item_price", item_price);
		}
		if (lang != null || !lang.equals(""))
		{
			apiparamsMap.put("lang", lang);
		}
		if (quantity != null || !quantity.equals(""))
		{
			apiparamsMap.put("quantity", quantity);
		}
		if (price != null || !price.equals(""))
		{
			apiparamsMap.put("price", price);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mProperties", mProperties);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * *更新一个sku的数据 *需要更新的sku通过属性properties进行匹配查找
	 * <p>
	 * *商品的数量和价格必须大于等于0
	 * <p>
	 * *sku记录会更新到指定的num_iid对应的商品中
	 * <p>
	 * *num_iid对应的商品必须属于当前的会话用户
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mProperties
	 * @param quantity
	 * @param price
	 * @param outer_id
	 * @param item_price
	 * @param lang
	 * @return
	 * @throws ApiException
	 */
	public String updateSku(String format, String mNum_iid, String mProperties,
			String quantity, String price, String outer_id, String item_price,
			String lang) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (item_price != null || !item_price.equals(""))
		{
			apiparamsMap.put("item_price", item_price);
		}
		if (lang != null || !lang.equals(""))
		{
			apiparamsMap.put("lang", lang);
		}
		if (quantity != null || !quantity.equals(""))
		{
			apiparamsMap.put("quantity", quantity);
		}
		if (price != null || !price.equals(""))
		{
			apiparamsMap.put("price", price);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mProperties", mProperties);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/************************** taobao.item.update *********************************/

	/**
	 * * 单个商品下架 * 输入的num_iid必须属于当前会话用户
	 * 
	 * @param format
	 * @param mNum_iid
	 * @return
	 * @throws ApiException
	 */
	public String delistingUpdate(String format, String mNum_iid)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 单个商品上架 * 输入的num_iid必须属于当前会话用户
	 * 
	 * @param format
	 * @param mNum_iid
	 * @param mNum
	 * @return
	 * @throws ApiException
	 */
	public String listingUpdate(String format, String mNum_iid, String mNum)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iid", mNum_iid);
		apiparamsMap.put("mNum", mNum);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 跟据卖家设定的商品外部id获取商品 这个商品对应卖家从传入的session中获取，需要session绑定
	 * 
	 * @param format
	 * @param mOuter_id
	 * @param mFields
	 * @return
	 * @throws ApiException
	 */
	public String getCustom(String format, String mOuter_id, String mFields)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mOuter_id", mOuter_id);
		apiparamsMap.put("mFields", mFields);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/********************************** taobao.items.ge **********************************/

	/**
	 * 获取当前用户作为卖家的仓库中的商品列表，并能根据传入的搜索条件对仓库中的商品列表进行过滤
	 * 只能获得商品的部分信息，商品的详细信息请通过taobao.item.get获取
	 * 
	 * @param format
	 * @param mFields
	 * @param q
	 * @param banner
	 * @param cid
	 * @param seller_cids
	 * @param page_no
	 * @param page_size
	 * @param has_discount
	 * @param order_by
	 * @param is_taobao
	 * @param is_ex
	 * @param start_modified
	 * @param end_modified
	 * @return
	 * @throws ApiException
	 */
	public String getInventory(String format, String mFields, String q,
			String banner, String cid, String seller_cids, String page_no,
			String page_size, String has_discount, String order_by,
			String is_taobao, String is_ex, String start_modified,
			String end_modified) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (q != null || !q.equals(""))
		{
			apiparamsMap.put("q", q);
		}
		if (banner != null || !banner.equals(""))
		{
			apiparamsMap.put("banner", banner);
		}
		if (cid != null || !cid.equals(""))
		{
			apiparamsMap.put("cid", cid);
		}
		if (seller_cids != null || !seller_cids.equals(""))
		{
			apiparamsMap.put("seller_cids", seller_cids);
		}
		if (page_no != null || !page_no.equals(""))
		{
			apiparamsMap.put("page_no", page_no);
		}
		if (page_size != null || !page_size.equals(""))
		{
			apiparamsMap.put("page_size", page_size);
		}
		if (has_discount != null || !has_discount.equals(""))
		{
			apiparamsMap.put("has_discount", has_discount);
		}
		if (order_by != null || !order_by.equals(""))
		{
			apiparamsMap.put("order_by", order_by);
		}
		if (is_taobao != null || !is_taobao.equals(""))
		{
			apiparamsMap.put("is_taobao", is_taobao);
		}
		if (is_ex != null || !is_ex.equals(""))
		{
			apiparamsMap.put("is_ex", is_ex);
		}
		if (start_modified != null || !start_modified.equals(""))
		{
			apiparamsMap.put("start_modified", start_modified);
		}
		if (end_modified != null || !end_modified.equals(""))
		{
			apiparamsMap.put("end_modified", end_modified);
		}
		apiparamsMap.put("mFields", mFields);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 查看非公开属性时需要用户登录
	 * 
	 * @param format
	 * @param mNum_iids
	 * @param mFields
	 * @return
	 * @throws ApiException
	 */
	public String getList(String format, String mNum_iids, String mFields)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mNum_iids", mNum_iids);
		apiparamsMap.put("mFields", mFields);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	public String getOnsale(String format, String mFields, String q,
			String banner, String cid, String seller_cids, String page_no,
			String page_size, String has_discount, String order_by,
			String is_taobao, String is_ex, String start_modified,
			String end_modified) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (q != null || !q.equals(""))
		{
			apiparamsMap.put("q", q);
		}
		if (banner != null || !banner.equals(""))
		{
			apiparamsMap.put("banner", banner);
		}
		if (cid != null || !cid.equals(""))
		{
			apiparamsMap.put("cid", cid);
		}
		if (seller_cids != null || !seller_cids.equals(""))
		{
			apiparamsMap.put("seller_cids", seller_cids);
		}
		if (page_no != null || !page_no.equals(""))
		{
			apiparamsMap.put("page_no", page_no);
		}
		if (page_size != null || !page_size.equals(""))
		{
			apiparamsMap.put("page_size", page_size);
		}
		if (has_discount != null || !has_discount.equals(""))
		{
			apiparamsMap.put("has_discount", has_discount);
		}
		if (order_by != null || !order_by.equals(""))
		{
			apiparamsMap.put("order_by", order_by);
		}
		if (is_taobao != null || !is_taobao.equals(""))
		{
			apiparamsMap.put("is_taobao", is_taobao);
		}
		if (is_ex != null || !is_ex.equals(""))
		{
			apiparamsMap.put("is_ex", is_ex);
		}
		if (start_modified != null || !start_modified.equals(""))
		{
			apiparamsMap.put("start_modified", start_modified);
		}
		if (end_modified != null || !end_modified.equals(""))
		{
			apiparamsMap.put("end_modified", end_modified);
		}
		apiparamsMap.put("mFields", mFields);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/*************************** taobao.items.search ****************************************/

	/**
	 * <p>
	 * 获取类目ID，必需是叶子类目ID；调用taobao.itemcats.get.v2获取 传入关键属性,
	 * <p>
	 * 结构:pid:vid;pid:vid.调用taobao.itemprops.get.v2获取pid,
	 * <p>
	 * 调用taobao.itempropvalues.get获取vid;如果碰到用户自定义属性,请用customer_props.
	 * 
	 * @param format
	 * @param mCid
	 * @param outer_id
	 * @param props
	 * @param binds
	 * @param sale_props
	 * @param customer_props
	 * @param mPrice
	 * @param mImage
	 * @param mName
	 * @param desc
	 * @param major
	 * @param market_time
	 * @param property_alias
	 * @return
	 * @throws ApiException
	 */
	public String add(String format, String mCid, String outer_id,
			String props, String binds, String sale_props,
			String customer_props, String mPrice, String mImage, String mName,
			String desc, String major, String market_time, String property_alias)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mCid", mCid);
		apiparamsMap.put("mName", mName);
		apiparamsMap.put("mImage", mImage);
		apiparamsMap.put("mPrice", mPrice);

		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (props != null || !props.equals(""))
		{
			apiparamsMap.put("props", props);
		}
		if (binds != null || !binds.equals(""))
		{
			apiparamsMap.put("binds", binds);
		}
		if (sale_props != null || !sale_props.equals(""))
		{
			apiparamsMap.put("sale_props", sale_props);
		}
		if (customer_props != null || !customer_props.equals(""))
		{
			apiparamsMap.put("customer_props", customer_props);
		}
		if (desc != null || !desc.equals(""))
		{
			apiparamsMap.put("desc", desc);
		}
		if (major != null || !major.equals(""))
		{
			apiparamsMap.put("major", major);
		}
		if (market_time != null || !market_time.equals(""))
		{
			apiparamsMap.put("market_time", market_time);
		}
		if (property_alias != null || !property_alias.equals(""))
		{
			apiparamsMap.put("property_alias", property_alias);
		}
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 两种方式查看一个产品详细信息: 传入product_id来查询 传入cid和props来查询
	 * 
	 * @param format
	 * @param product_id
	 * @param cid
	 * @param props
	 * @param mFields
	 * @return
	 * @throws ApiException
	 */
	public String get(String format, String product_id, String cid,
			String props, String mFields) throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (product_id != null || !product_id.equals(""))
		{
			apiparamsMap.put("product_id", product_id);
		}
		if (cid != null || !cid.equals(""))
		{
			apiparamsMap.put("cid", cid);
		}
		if (props != null || !props.equals(""))
		{
			apiparamsMap.put("props", props);
		}
		apiparamsMap.put("mFields", mFields);

		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 1.传入非主图ID 2.传入产品ID 删除产品非主图
	 * 
	 * @param format
	 * @param mProduct_id
	 * @param mId
	 * @return
	 * @throws ApiException
	 */
	public String deleteImgs(String format, String mProduct_id, String mId)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mProduct_id", mProduct_id);
		apiparamsMap.put("mId", mId);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	public String uploadImg(String format, String mProduct_id, String id,
			String mImage, String position, String is_major)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("position", position);
		}
		if (is_major != null || !is_major.equals(""))
		{
			apiparamsMap.put("is_major", is_major);
		}
		apiparamsMap.put("mProduct_id", mProduct_id);
		apiparamsMap.put("mImage", mImage);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * 1.传入属性图片ID 2.传入产品ID 删除一个产品的属性图片
	 * 
	 * @param format
	 * @param mProduct_id
	 * @param mId
	 * @return
	 * @throws ApiException
	 */
	public String deletePropimgs(String format, String mProduct_id, String mId)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mProduct_id", mProduct_id);
		apiparamsMap.put("mId", mId);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>
	 * 传入产品ID 传入props,目前仅支持颜色属性.调用taobao.itemprops.get.v2取得颜色属性pid,
	 * <p>
	 * 再用taobao.itempropvalues.get取得vid;格式:pid:vid,只能传入一个颜色pid:vid串;
	 * <p>
	 * 传入图片内容 注意：图片最大为2M,只支持JPG,GIF,如果需要传多张，可调多次
	 * 
	 * @param format
	 * @param mProps
	 * @param mProduct_id
	 * @param id
	 * @param position
	 * @param mImage
	 * @return
	 * @throws ApiException
	 */
	public String upoloadPropimgs(String format, String mProps,
			String mProduct_id, String id, String position, String mImage)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (id != null || !id.equals(""))
		{
			apiparamsMap.put("id", id);
		}
		if (position != null || !position.equals(""))
		{
			apiparamsMap.put("position", position);
		}
		apiparamsMap.put("mImage", mImage);
		apiparamsMap.put("mProps", mProps);
		apiparamsMap.put("mProduct_id", mProduct_id);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>传入产品ID 可修改字段：outer_id,binds,sale_props,name,price,desc,image 
	 * <p>注意：1.可以修改主图,不能修改子图片,主图最大500K,目前仅支持GIF,JPG 2.商城卖家产品发布24小时后不能作删除或修改操作
	 * @param format
	 * @param mProduct_id
	 * @param outer_id
	 * @param binds
	 * @param sale_props
	 * @param price
	 * @param desc
	 * @param image
	 * @param name
	 * @param major
	 * @param native_unkeyprops
	 * @return
	 * @throws ApiException
	 */
	public String update(String format, String mProduct_id, String outer_id,
			String binds, String sale_props, String price, String desc,
			String image, String name, String major, String native_unkeyprops)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (outer_id != null || !outer_id.equals(""))
		{
			apiparamsMap.put("outer_id", outer_id);
		}
		if (binds != null || !binds.equals(""))
		{
			apiparamsMap.put("binds", binds);
		}
		if (sale_props != null || !sale_props.equals(""))
		{
			apiparamsMap.put("sale_props", sale_props);
		}
		if (price != null || !price.equals(""))
		{
			apiparamsMap.put("price", price);
		}
		if (desc != null || !desc.equals(""))
		{
			apiparamsMap.put("desc", desc);
		}
		if (name != null || !name.equals(""))
		{
			apiparamsMap.put("name", name);
		}
		if (major != null || !major.equals(""))
		{
			apiparamsMap.put("major", major);
		}
		if (native_unkeyprops != null || !native_unkeyprops.equals(""))
		{
			apiparamsMap.put("native_unkeyprops", native_unkeyprops);
		}
		apiparamsMap.put("mProduct_id", mProduct_id);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	
	/**
	 * 根据淘宝会员帐号搜索所有产品信息 注意：支持分页，每页最多返回100条,默认值为40,页码从1开始，默认为第一页
	 * @param format
	 * @param mFields
	 * @param mNick
	 * @param props
	 * @param page_no
	 * @param page_size
	 * @return
	 * @throws ApiException
	 */
	public String get(String format, String mFields, String mNick,
			String props, String page_no, String page_size)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (props != null || !props.equals(""))
		{
			apiparamsMap.put("props", props);
		}
		if (page_no != null || !page_no.equals(""))
		{
			apiparamsMap.put("page_no", page_no);
		}
		if (page_size != null || !page_size.equals(""))
		{
			apiparamsMap.put("page_size", page_size);
		}
		apiparamsMap.put("mFields", mFields);
		apiparamsMap.put("mNick", mNick);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}
	
	
	/**
	 * <p>两种方式搜索所有产品信息(二种至少传一种): 
	 * <p>传入关键字q搜索 传入cid和props搜索 返回值支持:product_id,name,pic_path,cid,props,price,tsc
	 *  <p>当用户指定了cid并且cid为垂直市场（3C电器城、鞋城）的类目id时，默认只返回小二确认的产品。
	 *  <p>如果用户没有指定cid，或cid为普通的类目，默认返回商家确认或小二确认的产品。
	 *  <p>如果用户自定了status字段，以指定的status类型为准
	 * @param format
	 * @param mFields
	 * @param q
	 * @param cid
	 * @param props
	 * @param status
	 * @param page_no
	 * @param page_size
	 * @param vertical_market
	 * @return
	 * @throws ApiException
	 */
	public String searchProducts (String format, String mFields , String q,
			String cid, String props, String status, String page_no,
			String page_size, String vertical_market)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		if (q != null || !q.equals(""))
		{
			apiparamsMap.put("q", q);
		}
		if (cid != null || !cid.equals(""))
		{
			apiparamsMap.put("cid", cid);
		}
		if (props != null || !props.equals(""))
		{
			apiparamsMap.put("props", props);
		}
		if (status != null || !status.equals(""))
		{
			apiparamsMap.put("status", status);
		}
		if (page_no != null || !page_no.equals(""))
		{
			apiparamsMap.put("page_no", page_no);
		}
		if (page_size != null || !page_size.equals(""))
		{
			apiparamsMap.put("page_size", page_size);
		}
		if (vertical_market != null || !vertical_market.equals(""))
		{
			apiparamsMap.put("vertical_market", vertical_market);
		}
		apiparamsMap.put("mFields", mFields);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}

	/**
	 * <p>跟据卖家设定的Sku的外部id获取商品，如果一个outer_id对应多个Sku会返回所有符合条件的sku 
	 * <p>这个Sku所属卖家从传入的session中获取，需要session绑定
	 * <p>(注：iid标签里是num_iid的值，可以用作num_iid使用)
	 * @param format
	 * @param mOuter_id
	 * @param mFields
	 * @return
	 * @throws ApiException
	 */
	
	public String getCustomSkus (String format,String mOuter_id,String mFields)
			throws ApiException
	{
		TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
		apiparamsMap.putAll(APIUtil.getSystemParams());
		if (format != null || !format.equals(""))
		{
			apiparamsMap.put("format", format);
		}
		apiparamsMap.put("mFields", mFields);
		apiparamsMap.put("mOuter_id", mOuter_id);
		String sign = APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);

		String paramsString = APIUtil.getContent(apiparamsMap);
		String responseData = APIUtil.getResult(AppConstants.APIURL,
				paramsString);

		return responseData;
	}
	
	
	 
}
